<?php

//根据积分返回等级数
/**
*	@功能:	     根据积分返回等级数
*	@param1: 积分
*	@param2: 等级 (暂无)
*	@返回值:    返回数组: [当前的积分,等级数]
*/

//var_dump(myLevels(2223));

function myLevel($grade = 0) {

	// var_dump($grade);
	// var_dump($levels);
	if ($grade < 0) {

		exit('积分不得为负数');
	}
	if ($grade <= 200) {

		$levName = 'LV1';
		$border    = 0;
	} else if ($grade <= 400) {

		$levName = 'LV2';
		$border    = 201;
	} else if ($grade <= 600) {

		$levName = 'LV3';
		$border    = 401;
	} else if ($grade <= 800) {

		$levName = 'LV4';
		$border    = 601;
	} else if ($grade <= 1000) {
		
		$levName = 'LV5';
		$border    = 801;
	} else if ($grade <= 1200) {
		
		$levName = 'LV6';
		$border    = 1001;
	} else if ($grade <= 1400) {
		
		$levName = 'LV7';
		$border    = 1201;
	} else if ($grade <= 1600) {
		
		$levName = 'LV8';
		$border    = 1401;
	}else if ($grade <= 1800) {
		
		$levName = 'LV9';
		$border    = 1601;
	} else {

		$levName = 'LV10';
		$border    =  1801;
	}

	return [$grade , $levName , $border];
}

